macOS Notes 是一个用于管理 macOS 备忘录(Apple Notes)的技能,通过 $SKILL_DIR/scripts/notes.sh 脚本调用 AppleScript 实现。备忘录内容在系统内部以 HTML 存储,脚本接受纯文本或 HTML 正文,读取时返回纯文本。
用途 该技能用于在 macOS 上创建、读取、搜索和管理备忘录。当用户要求记笔记、记录想法、保存会议纪要或查找已有笔记时使用。
主要能力
- 列出文件夹:发现账户和文件夹名称,输出格式为 account → folder,每行一个。
- 创建笔记:通过 JSON 指定 title(必填)、body(纯文本,自动转换为 HTML)、html(原始 HTML,若同时提供则覆盖 body)、folder、account。
- 读取笔记:通过 JSON 指定 name(必填,精确匹配标题)、folder、account。
- 列出笔记:通过 JSON 指定 folder、account、limit(默认 20)。
- 搜索笔记:通过 JSON 指定 query(必填,在笔记标题中搜索)、account、limit(默认 10)。
使用方式 所有命令通过标准输入传入 JSON,例如:
- 列出文件夹:"$SKILL_DIR/scripts/notes.sh" list-folders
- 创建笔记:echo '<json>' | "$SKILL_DIR/scripts/notes.sh" create-note
- 读取笔记:echo '<json>' | "$SKILL_DIR/scripts/notes.sh" read-note
- 列出笔记:echo '<json>' | "$SKILL_DIR/scripts/notes.sh" list-notes
- 搜索笔记:echo '<json>' | "$SKILL_DIR/scripts/notes.sh" search-notes
自然语言映射示例:
- “Note this down: ...” → create-note,字段 title、body
- “Save meeting notes” → create-note,title: "Meeting notes — <date>",body
- “What did I write about X?” → search-notes,query: "X"
- “Show my notes” → list-notes(默认参数)
- “Read my note about X” → read-note,name: "X"
- “Save this in my work notes” → create-note,从 list-folders 匹配最接近的 account/folder
示例提示:
- “Note down the API key format: prefix_xxxx” → echo '{"title":"API key format","body":"Format: prefix_xxxx"}' | "$SKILL_DIR/scripts/notes.sh" create-note
- “Show my recent notes” → echo '{}' | "$SKILL_DIR/scripts/notes.sh" list-notes
- “What did I write about passwords?” → echo '{"query":"password"}' | "$SKILL_DIR/scripts/notes.sh" search-notes
- “Read my note about Hinge” → echo '{"name":"Hinge"}' | "$SKILL_DIR/scripts/notes.sh" read-note
- “Create a meeting summary in my iCloud notes” → 先运行 "$SKILL_DIR/scripts/notes.sh" list-folders,然后 echo '{"title":"Meeting summary — 2026-02-17","body":"Discussed roadmap.\n- Q1: launch MVP\n- Q2: iterate","account":"iCloud","folder":"Notes"}' | "$SKILL_DIR/scripts/notes.sh" create-note
适用场景 适用于需要快速记录、检索和管理 macOS 备忘录的日常场景,如记录 API 密钥格式、保存会议纪要、查找关于特定主题的笔记等。
限制与规则
- 如果用户未指定账户或文件夹,应始终先列出文件夹,因为文件夹名称在不同账户间可能重复。
- 定位特定位置时需同时指定 account 和 folder,仅指定 folder: "Notes" 会有歧义。
- 密码保护的笔记会被跳过,脚本无法读取或修改。
- JSON 必须通过标准输入传入,不能作为命令行参数,以避免在进程列表中泄露数据。
- 所有字段由脚本验证(类型转换、范围检查),无效输入会被拒绝并报错。
- 所有操作记录到 logs/notes.log,包含时间戳、命令和笔记标题。
- body 使用纯文本,换行会自动转换为 <br>;如需富文本格式请使用 html 字段。
- 笔记标题即正文第一行,Notes.app 将正文第一行视为笔记名称。